/**
 * Created: 03/24/2010
 */
package org.klarblick.linkbox.model.entities;

/**
 * Entity class representing a tag. Beside a {@link Category} tags are used to organize links.
 * 
 * @author Sebastian Engel <sebastian.engel@klarblick.org>
 *
 */
public class Tag {
	
	private long id;
	
	private String name;
	
	/**
	 * Indicates if this tag and the given tag are equal.
	 * 
	 * @param tag the tag to test on equality
	 * @return true, if the given object is a {@link Tag} and its name is
	 *         equal to the one of this tag.
	 */
	@Override
	public boolean equals(Object tag) {
		boolean equal = false;
		try {
			Tag compTag = (Tag) tag;
			if (compTag.getName().equalsIgnoreCase(name)) {
				equal = true;
			}
		} catch (ClassCastException e) {
			// equal remains false
		}
		return equal;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
